﻿@namespace ThingsGateway.Web.Rcl.Core
@inherits CultureComponentBase

<MDatePicker Value="Date" Class="ClassString"
             ValueChanged="DateChangedAsync"
             TValue="DateOnly?"
             NoTitle="NoTitle"
             Max="@GetMaxDateOnly()"
             Min="@GetMinDateOnly()">
    <MRow Dense Align="AlignTypes.Center" Style="width: min-content; padding: 0 12px;">
        <MCol Cols="4">
            <MAutocomplete AutoSelectFirst Dense
                           Label="@T("Hour")"
                           HideDetails="true"
                           Value="Time.Hour"
                           ValueChanged="HourChangedAsync"
                           TValue="int"
                           TItem="int"
                           TItemValue="int"
                           Items="GetHours()"
                           ItemText="h => h.ToString().PadLeft(2, '0')"
                           ItemValue="h => h"
                           MenuProps="menu => menu.MaxHeight = 176">
            </MAutocomplete>
            </MCol>
            <MCol Cols="4">
            <MAutocomplete AutoSelectFirst Dense
                           Label="@T("Minute")"
                           HideDetails="true"
                           Value="Time.Minute"
                           ValueChanged="MinuteChangedAsync"
                           TValue="int"
                           TItem="int"
                           TItemValue="int"
                           Items="GetMinutes()"
                           ItemText="m => m.ToString().PadLeft(2, '0')"
                           ItemValue="m => m"
                           MenuProps="menu => menu.MaxHeight = 176">
            </MAutocomplete>
            </MCol>
            <MCol Cols="4">
            <MAutocomplete AutoSelectFirst Dense
                           Label="@T("Second")"
                           HideDetails="true"
                           Value="Time.Second"
                           ValueChanged="SecondChangedAsync"
                           TValue="int"
                           TItem="int"
                           TItemValue="int"
                           Items="GetSeconds()"
                           ItemText="s => s.ToString().PadLeft(2, '0')"
                           ItemValue="s => s"
                           MenuProps="menu => menu.MaxHeight = 176">
            </MAutocomplete>
            </MCol>
            <MCol Cols="12" Style="display: flex">
            <MButton Text Color="primary" Disabled="GetNowClickState()" OnClick="OnNowAsync">@T("Now")</MButton>
            <MSpacer></MSpacer>
            <MButton Text OnClick="OnResetAsync">@T("Reset")</MButton>
            @ChildContent
            </MCol>
            </MRow>
            </MDatePicker>

            @code {

    [Parameter]
    public string ClassString { get; set; }
            }